﻿using System;
using System.Text;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using Esint.JudicialAuction.Model;
using Esint.JudicialAuction.Factory;
using Esint.JudicialAuction.IDAL;
using Esint.Common.Model;

namespace Esint.JudicialAuction.BLL
{
    /// <summary>
    /// 文件说明:  业务逻辑层
    /// 作    者: 谷明
    /// 生成日期: 2020年03月02日
    /// 模板版本: Esint.Template.BLL.BLL_01 版，适用于简单三层开发!
    /// 功能说明：
    /// </summary>
    public partial class Sys_UserService
    {
        /// <summary>
        /// 功    能: 保存对象
        /// 说    明: 当主键为空时，新增操作
        ///           当主键不为空，根据主键进行修改
        /// <summary>
        public void Save(Sys_UserInfo sys_User)
        {
            if (String.IsNullOrEmpty(sys_User.UserId))
            {
                sys_User.UserId = Guid.NewGuid().ToString();
                dataAccess.Insert(sys_User);
            }
            else
            {
                dataAccess.Update(sys_User);
            }
        }

        /// <summary>
        /// 根据用户名和密码获取用户实体
        /// </summary>
        /// <param name="userName"></param>
        /// <param name="password"></param>
        /// <returns></returns>
        public Sys_UserInfo GetUserModelByUserNameAndPwd(string userName, string password)
        {
            return dataAccess.GetUserModelByUserNameAndPwd(userName, password);
        }

        /// <summary>
        /// 查询主列表（分页）
        /// </summary>
        /// <param name="userName"></param>
        /// <param name="cellphone"></param>
        /// <param name="userType"></param>
        /// <param name="status"></param>
        /// <returns></returns>
        public ReturnTable GetMainList(string userName, string cellphone, string userType, string status, int pageSize, int pageIndex)
        {
            return dataAccess.GetMainList(userName, cellphone, userType, status, pageSize, pageIndex);
        }

        /// <summary>
        /// 批量删除用户方法
        /// </summary>
        /// <param name="idList"></param>
        public void DeleteUsers(List<string> idList)
        {
            dataAccess.DeleteUsers(idList);
        }

        /// <summary>
        /// 启用禁用用户方法
        /// </summary>
        /// <param name="idList"></param>
        /// <param name="IsDisabled"></param>
        public void DisabledUsers(List<string> idList, string IsDisabledFlag)
        {
            dataAccess.DisabledUsers(idList, Convert.ToBoolean(IsDisabledFlag));
        }
    }
}
